<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%@ include file="/WEB-INF/common/public.jspf"%>
<%@ include file="/WEB-INF/common/easyui.jspf"%>

<title>设置签到</title>
</head>

<script language="javascript" type="text/javascript">
  $(function(){
	  
	 
	
	  $("#setting").dialog({
			buttons:[{
			text:'生成二维码',
			handler:function(){
						var classId=$('#classId').val();
						var tId=${sessionScope.teacher.tId}
						var className=$('#className').val();
						if(classId == "请选择" || className== "请选择"){
							alert("请选择班级编号和课程名称");
							return;
						}
						var time=$('#time').val();
						if(time==""){
							time=3;
						}
						$.ajax({
								type:'get',
								url:'/qrcode/getQRCode/'+time+'/'+classId+'/'+tId+'/'+className,
								success:function(){
									 parent.$("#win2").dialog({  
											title: '',    
										    width: 315,    
										    height: 348,    
										    closed: false,    
										    cache: false,    
										    modal: true,
										    buttons:[{
												text:'结束签到',
												handler:function(){
													parent.$("#win2").dialog("close",true);
													parent.$("#qrcode").attr("src","");
												}
											}]
										    
									 });
									 parent.$("#qrcode").attr("src","/qrcode/getCode?time="+new Date());
									
									
								}
							});
				
			
			}
			}]}
	  );
		
	  
  })


</script>


<body>

	<div id="setting" class="easyui-dialog" title=""
		style="width: 400px; height: 200px; padding: 30px"
		data-options="iconCls:'',resizable:false,modal:true,draggable:false">

		<form id="ff" method="post">
			班级编号:<select id="classId"  name="dept"
				style="width: 200px;">
				<option>请选择</option>
				
			</select> <br /> <br /> 课程名称:<select id="className" 
				name="dept" style="width: 200px;">
				<option>请选择</option>
				
			</select> <br /> <br /> 签到时长:<input id="time" class="easyui-numberspinner"
				style="width: 50px;" data-options="min:1,max:100,editable:true">
			分钟





		</form>


	</div>





</body>
<script language="javascript" type="text/javascript">

	$(function (){
		$.ajax({
			  type:'get',
			  url: "/signin/getCouseInfo",
			  dataType:'json',
			  success:function(data){
				  var v1=data.data.classId;
				  var v2=data.data.course;
				  for(var i=0;i< v1.length;i++){
					 $("#classId").append("<option>"+v1[i]+"</option>");
				  }
				  for(var j=0;j< v2.length;j++){
						 $("#className").append("<option>"+v2[j].courseName+"</option>");
					  }
			  }
		})
	});

	

</script>
</html>